<?php

use yii\db\Migration;

/**
 * Class m180222_013427_alter_money_related_fields
 */
class m180222_013427_alter_money_related_fields extends Migration
{
    /**
     * @inheritdoc
     */
    public function safeUp()
    {
        $this->alterColumn('package', 'principal', $this->decimal(20, 2)->comment('本金（元）')->notNull());
        $this->alterColumn('package', 'interest', $this->decimal(20, 2)->comment('利息（元）')->notNull());
        $this->alterColumn('package', 'broke_principal', $this->decimal(20, 2)->comment('破产本金（元）')->notNull());

        $this->alterColumn('project', 'principal', $this->decimal(20, 2)->comment('本金（元）')->notNull());
        $this->alterColumn('project', 'interest', $this->decimal(20, 2)->comment('利息（元）')->notNull());

        $this->alterColumn('project_pre_evaluation_mortgage', 'mortgage_principal', $this->decimal(20, 2)->comment('抵押本金（元）')->notNull());
        $this->alterColumn('project_pre_evaluation_mortgage', 'mortgage_interest', $this->decimal(20, 2)->comment('抵押利息（元）')->notNull());

    }

    /**
     * @inheritdoc
     */
    public function safeDown()
    {
        echo "m180222_013427_alter_money_related_fields cannot be reverted.\n";

        return false;
    }

    /*
    // Use up()/down() to run migration code without a transaction.
    public function up()
    {

    }

    public function down()
    {
        echo "m180222_013427_alter_money_related_fields cannot be reverted.\n";

        return false;
    }
    */
}
